home *** CD-ROM | disk | FTP | other *** search
/ Best of www.BestZips.com (Collector's Edition) / Best of WWW.BESTZIPS.COM Collector's Edition (JCSM Shareware) (JCS Marketing).ISO / menues__ / 4dos552.zip / ALIASES (.txt) < prev    next >
Microsoft Windows Help File Content  |  1996-04-17  |  10KB  |  189 lines

  1. :                     ALIASES -- 4DOS Sample Alias File
  2. :     The aliases in this file are designed to give you some examples of
  3. :     how 4DOS aliases can be used and the power they have.  It is not
  4. :     intended to be an exhaustive list, and many of these may not be
  5. :     appropriate for your needs.  But they should give you a feel for how
  6. :     to use aliases to help get your work done.
  7. :     CAUTION:  These aliases are EXAMPLES.  We do NOT promise that they
  8. :     will work properly when run on your system.  They are simply intended
  9. :     to show what's possible and give you a feel for how to write your
  10. :     own set of aliases.  You may find some of them useful, but others
  11. :     may fail or have unintended effects when they are run on a system
  12. :     other than the one they were designed for.
  13. :     This file is designed to be loaded with an ALIAS /R command, for
  14. :     example:
  15. :               alias /r aliases
  16. :     You can also load aliases from a batch file, but ALIAS /R is much
  17. :     faster.  See the manual for more details on loading aliases.
  18. :     We suggest you put your standard aliases are in a self-contained
  19. :     file like this one which can be invoked from AUTOEXEC.  That
  20. :     way the file can also be re-invoked after it is edited, to re-
  21. :     install the aliases.
  22. :     The next few aliases set up some directory commands that provide
  23. :     shorthand ways to view the directory in several different formats
  24. :     (see the DIR command in the manual for more details).
  25. :     Note that none of these aliases has any arguments specified (%1,
  26. :     %2, etc.).  This means that all arguments on the actual command line
  27. :     will be appended to the alias text.  For example:
  28. :             d2 x*
  29. :     is equivalent to:
  30. :             dir /2pv x*
  31. :     and:
  32. :             d2 x* y* z*
  33. :     is equivalent to:
  34. :             dir /2pv x* y* z*
  35. d2 dir /2pv
  36. de dir /oe
  37. dir *dir /p
  38. wh*ereis dir /dp
  39. :     The last two commands above demonstrate the use of an asterisk to
  40. :     terminate alias expansion and to shorten the name of an alias.
  41. :     In the first case, if the command were defined as:
  42. :             alias dir dir/p
  43. :     it would generate an alias loop error.  The inclusion of the "*"
  44. :     makes 4DOS terminate alias expansion for that command, which
  45. :     allows the redefinition of a command with specific switch settings.
  46. :     In this case "dir" is redefined as "dir/p", which will cause
  47. :     directories to be displayed with a pause at the end of each page.
  48. :     The "whereis" command demonstrates truncation of an alias name.
  49. :     The * is placed after the last required character in the name, so
  50. :     the "whereis" command can be entered as "wh", "whe", "wher",
  51. :     "where", "wherei", or "whereis".
  52. :     The following aliases are more shorthand:  DD and DU (directory
  53. :     down and directory up) for pushd and popd, DX (shows only the
  54. :     subdirectorie, L for list, etc.
  55. dd pushd
  56. du popd
  57. dx *dir /mwad
  58. l list
  59. clr mode mono
  60. :     Aliases can also be used to modify the behavior of some internal
  61. :     commands.  The two examples below show how you can force DELETE and
  62. :     MOVE to prompt before execution.  If you need to use the unprompted
  63. :     command, use the leading asterisk ("*DEL").
  64. del*ete *del /p
  65. move *move /r
  66. :     The next aliases show how some commands can be enhanced.  Instead of
  67. :     always prompting you for new values, TIME and DATE can simply report
  68. :     the current information.
  69. date echo Today is %_dow %_date
  70. time echo The time is %_time
  71. :     Here's what the next few aliases do:
  72. :             more:   Uses 4DOS's LIST /S as a substitute for the DOS MORE
  73. :                     command.  Note the use of the * to allow the command
  74. :                     to be entered as MO, MOR, or MORE
  75. :             ff:     Uses the 4DOS FFIND command to find a file anywhere
  76. :                     in the current directory or any of its subdirectories,
  77. :                     for example:
  78. :                             ff *.dat
  79. :             fft:    Like FF, but assumes that the second and following
  80. :                     arguments are text to look for within the files.  For
  81. :                     example, to find all .DAT files with the string "hello
  82. :                     Barbara" in them you could use this command:
  83. :                             fft *.dat hello barbara
  84. :             sdel:   Allows you to select files for deletion from a subset
  85. :                     of files as specified in the command argument.  For
  86. :                     example:
  87. :                             sdel *.obj
  88. :                     will allow you to select files to delete from a list
  89. :                     of all .obj files.  (See the SELECT command in the
  90. :                     manual for more details).
  91. :             up:     Moves "up" in the directory tree, i.e. to the parent
  92. :                     directory.
  93. :             ov:     Moves "over" in the directory tree, to another subdi-
  94. :                     rectory which has the same parent as the current
  95. :                     directory.
  96. mo*re list /s
  97. ff ffind /s
  98. fft ffind /s /t"%2&" %1 
  99. sdel select del (%1)
  100. up cd ..
  101. ov cd ..\%1
  102. :     The next two aliases show how arguments can be passed to commands.
  103. :     In both cases the argument given when the alias is invoked is passed
  104. :     to the program at the appropriate place in its command string.
  105. lp lpr -u %1 >lpt1
  106. ps d:\peri\ps /t:%1 /e:4
  107. :     The next few aliases demonstrate several things.  Some use the
  108. :     command separator character ^ to include multiple commands in
  109. :     the alias.  ND2 uses the "&&" (AND) operator so that the second
  110. :     command is only executed if the first was succcessful.  The last
  111. :     two (PC and BACK) use the alias called IN to do their job.  In
  112. :     fact IN was designed for "internal" use by other aliases in this
  113. :     file, though it could be used elsewhere as well.  Note that, while
  114. :     PX is set up before it is referenced in other aliases, this is not
  115. :     really necessary, because any command in one alias which refers to
  116. :     another is handled when the alias is invoked, not when it is set
  117. :     up with the alias command.
  118. :     Here's what each alias does:
  119. :             nd:     Creates a new directory below the current directory,
  120. :                     then changes to it.
  121. :             nd2:    Attempts to creates the specified directory on any
  122. :                     drive, then changes to it if the creation was
  123. :                     successful.
  124. :             w:      Saves the current directory, changes to the ws
  125. :                     directory on drive c:, runs the ws program using
  126. :                     the first argument on the command line, and
  127. :                     restores the original directory when done.
  128. :             zap:    Deletes all the .bak files in the current directory,
  129. :                     then does a wide directory listing.
  130. :             in:     "Pushes" a different directory, executes a command,
  131. :                     including all of the arguments on the command line,
  132. :                     and then goes back to the original directory.  See
  133. :                     PUSHD, POPD, and Alias Parameters in the manual for
  134. :                     more details.
  135. :             pc:     Changes to the \comm directory on drive c:, runs
  136. :                     the program called pcomm, then returns to the
  137. :                     drive and directory in use when the command was
  138. :                     executed.
  139. :             back:   Changes to the \backup directory on drive d:, runs
  140. :                     the program called tape, then returns to the previous
  141. :                     drive and directory.
  142. nd md %1^cd %1
  143. nd2 md %1 && *cdd %1
  144. w pushd c:\wp^ws %1^popd
  145. zap del *.bak^dir /w
  146. in pushd %1^%2&^popd
  147. pc in c:\comm pcomm
  148. back in d:\backup tape
  149. :     The following aliases make use of the %& argument.  This argument
  150. :     means "all of the arguments on the command line".  For example:
  151. :             zap2 *.bak *.lst *.bk!
  152. :     expands to:
  153. :             erase *.bak *.lst *.bk!^chkdsk^dir /w
  154. :     The last of the three aliases below uses the %@eval function to
  155. :     create a command-line calculator, by simply passing all arguments
  156. :     on the command line to the function.
  157. zap2 erase %&^chkdsk^dir /w
  158. ed edit %&^del *.bak
  159. cal*c echo The answer is:  %@eval[%&]
  160. :     The following two aliases, taken from the manual, show how to 
  161. :     combine alias with keystack to invoke a program and pass parameters
  162. :     to it.  See the manual for details on what they do.  Note that the
  163. :     0s in the keystack strings simulate an empty keyboard buffer; the
  164. :     13s are carriage returns.
  165. 321 keystack 0 13 0 13 0 13 0 13 0 13 "/fr" 0 "%1" 13^123
  166. drpt pushd c:\data^keystack "use times index times" 13 "report form timerep to print" 13 "quit" 13^dbase^popd
  167. :     The following aliases show the use of IFF in aliases.  The first
  168. :     redefines SET so that it displays the environment variables with a
  169. :     /P if no parameters are given, or processes the SET if parameters
  170. :     are specified.  The second checks whether the argument is a directory;
  171. :     if so it deletes the files in the directory and then removes the
  172. :     directory.  If not, it gives an error message.
  173. set iff "%1"=="" then ^ *set /p ^ else *set %& ^ endiff
  174. zap iff isdir %1 then ^ *del %1 ^ *rd %1 ^ else ^ beep ^ echo Not a directory! ^ endiff
  175. :     You can also assign any alias to a keystroke to save a lot of typing.
  176. :     Check your manual for the proper way to express keynames.
  177. :     The following examples reassign the following keys:
  178. :           F5         wide directory
  179. :           Ctrl-F1    clear screen
  180. :           Alt-F1     invokes another HELP program
  181. :           Shift-F10  "exit" (useful when "shelling out")
  182. :     Note that the last alias, for Shift-F10, uses a leading @@.  This
  183. :     makes the alias execute immediately, rather than waiting for you to
  184. :     press Enter.
  185. @f5 dir /w
  186. @Ctrl-F1 cls
  187. @alt-f1 c:\dos\help
  188. @@shift-f10 exit
  189.